
import java.awt.Color;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.event.MouseMotionListener;
import java.awt.geom.Point2D;

import javax.swing.JButton;
import javax.swing.Timer;

import mover.Mass;
import mover.Mover;

import extensible.Canvas;


/**
 *
 * @author Jonathan Su and Jeff Forte
 */
class ClearListener implements ActionListener {
	private Canvas myCanvas;

	ClearListener(Canvas c) {
		myCanvas = c;
	}

	public void actionPerformed(ActionEvent e) {
		myCanvas.clear();
		myCanvas.removeMouseSpring = true;
		myCanvas.repaint();
	}

}

class StepListener implements ActionListener {
	private Canvas myCanvas;
	
	StepListener(Canvas canvas) {
		myCanvas = canvas;
	}
	
	public void actionPerformed(ActionEvent e) {
		myCanvas.update();
        myCanvas.repaint();
	}
}

class PauseListener implements ActionListener {
	private Applet myApplet;
	
	PauseListener(Applet applet) {
		myApplet = applet;
	}
	
	public void actionPerformed(ActionEvent e) {
		myApplet.stop();
	}
}

class StartListener implements ActionListener {
	private Applet myApplet;
	
	StartListener(Applet applet) {
		myApplet = applet;
	}
	
	public void actionPerformed(ActionEvent e) {
		myApplet.start();
	}
}


class RemoveIndividualListener implements ActionListener {
	private Canvas myCanvas;

	RemoveIndividualListener(Canvas c) {
		myCanvas = c;
	}

	public void actionPerformed(ActionEvent e) {
		Mover myMover = myCanvas.getCurrentMover();
		if (myMover != null) {
			myCanvas.remove(myMover);
		}
	}
}


class WrapListener implements ActionListener {
	private Canvas myCanvas;

	WrapListener(Canvas c) {
		myCanvas = c;
	}

	public void actionPerformed(ActionEvent e) {
		myCanvas.toggleWrapAround();
	}
}
